home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
bytesc88.arc
/
STRNCMP.C
< prev
next >
Wrap
Text File
|
1987-10-04
|
384b
|
14 lines
/*
** strncmp(s,t,n) - Compares two strings for at most n
** characters and returns an integer
** >0, =0, or <0 as s is >t, =t, or <t.
*/
strncmp(s, t, n) char *s, *t; int n; {
while(n && *s==*t) {
if (*s == 0) return (0);
++s; ++t; --n;
}
if(n) return (*s - *t);
return (0);
}